package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.controller.BaseController;
import com.zzyl.service.CustomerOrdersService;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.CustomerOrdersVo;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/customer/orders/project")
@Api(tags = "服务")
public class CustomerOrdersController extends BaseController {

    @Autowired
    private CustomerOrdersService CustomerOrdersVoService;

    @GetMapping("/page")
    @ApiOperation("条件分页查询护项目")
    public ResponseResult<PageResponse<CustomerOrdersVo>> list(@ApiParam(value = "护理项目名称", required = false) String name,
                                                               @ApiParam(value = "当前页码", defaultValue = "1") Integer pageNum,
                                                               @ApiParam(value = "当前页码", defaultValue = "10") Integer pageSize,
                                                               @ApiParam(value = "状态", required = false) Integer status) {
        PageResponse<CustomerOrdersVo> pageResponse = CustomerOrdersVoService.list(name, pageNum, pageSize, status);
        return success(pageResponse);
    }


    @GetMapping("/{id}")
    @ApiOperation("根据Id查询护理项目")
    private ResponseResult<CustomerOrdersVo> findById(@PathVariable @ApiParam(value = "ID", required = true) Long id) {
        CustomerOrdersVo customerOrdersVo=CustomerOrdersVoService.findById(id);
        return success(customerOrdersVo);
    }
}
